#include "Event.h"

Event::Event()
{
	memset(name, 0, NAMELEN);
	memset(command, 0 , NAMELEN);
}

Event::Event(const Event &Source)
{
	Copy(Source);
}

Event::~Event()
{
}

Event & Event::operator = (const Event &Source)
{
	Copy(Source);
	return *this;
}

bool Event::DoEvent(Container<Value> Arguments)
{
	//Put in Code that corisponds to when an event as triggered
	if(Arguments.Size() != Parameters.Size())
		return false;
	bool IsGood = true;
	for(int i = 0; i < Parameters.Size(); i++)
		if(Arguments[i].GetType() != Parameters[i].GetType())
		{
			IsGood = false;
			break;
		}

	if(IsGood)
	{
		Command NewCommand;
		NewCommand.name = command;
		NewCommand.Arguments = Arguments;
		IsGood = m_PluginManager.HandleCommand(NewCommand);
	}
	
	return IsGood;
}

void Event::Copy(const Event &Source)
{
	memcpy(name, Source.name, NAMELEN);
	memcpy(command,  Source.command, NAMELEN);
	Parameters = Source.Parameters;
}